home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14406 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.perl.misc,comp.lang.c
  4. Subject: Re: PROGRAMERS OF ANY LANGUAGE
  5. Date: 14 Apr 1996 09:12:57 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4kr869INN35k@keats.ugrad.cs.ubc.ca>
  8. References: <Pine.SOL.3.91.960329010021.13209A-100000@harvey> <316A6189.4287@wight.hursley.ibm.com> <4kg58c$djh@kalypso.cybercom.net> <4kqe6q$1tm@innocence.interface-business.de>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4kqe6q$1tm@innocence.interface-business.de>,
  12. J Wunsch <joerg_wunsch@uriah.heep.sax.de> wrote:
  13. >stok@kalypso.cybercom.net (Michael J. Stok) writes:
  14. >
  15. >> The {}s shouldn't be optional!  That's the route Perl took with blocks 
  16. >> after for, if, while, else etc.  Just because C and similar languages 
  17. >> have the "optimisation" that they the {}s are optional doesn't mean it's 
  18. >> right :-)
  19. >
  20. >Just because Perl allows for the "optimisation" to put the "if" before
  21. >or after the statement, and mandates the curlies _for one of the options_,
  22. >doesn't make the code better per se. :-)
  23.  
  24. Perl cops out of resolving the classic ``if/then ambiguity'' by forcing the
  25. required syntactic units to be compound statements, doesn't it?
  26.  
  27. In Perl, you write:
  28.  
  29.     if (....) 
  30.         if (....)
  31.             if (....)
  32.                 statement;
  33.     else
  34.         statement;
  35.  
  36. The programmer is forced to ``disambiguate'':
  37.  
  38.     if (....) {
  39.         if (....) {    
  40.             if (....) {
  41.                 statement;
  42.             }
  43.         }
  44.     } else {
  45.         statement;
  46.     }
  47.  
  48. What a PITA. (And I ain't referring to an Italian meal also known as a pizza
  49. pocket, either).
  50.